--
-- Author: shunguo.chen
-- Date: 2017-12-29 10:43:24
--
-- PvpRewardVo pvp奖励vo

local Daibi = require("app.public.dao.Daibi")

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data)
    if data then
        self:init(data)
    end
end

-- message TournamentRewardItem {
--   TournamentRewardType rewardType = 1;
--   shared.Loot loot = 2;
--   int32 itemCount = 3;
-- }
-- message TournamentReward {
--   TournamentRewardItem rewardItem = 1;
--   bool isFirstWon = 2;
--   bool isBoost = 3;
-- }
function ClassRef:init(data) 
	-- 这里有别的协议时 isFirstWin，业务使用统一使用 isFirstWin
	self.isFirstWin = data.isFirstWon
	self.isBoost = data.isBoost

	local item = data.rewardItem
	if item.rewardType == "tournamentScore" then
		-- 赛季经验
		self.itemData = Daibi.new()
		self.itemData:read({tid=Constant.PVP_SESSION_EXP_ID, amount=item.itemCount})
	elseif item.rewardType == "tournamentStar" then
		-- 赛季星章
		self.itemData = Daibi.new()
		self.itemData:read({tid=84, amount=item.itemCount})
	else
		self.itemData = UD:parseLootToBagItem(item.loot)
	end
end

return ClassRef